package com.steven.collection;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;

public class MapDemo {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Map<String, String> map = new HashMap<String, String>();
		map.put("1", "德信");
		map.put("2", "和利時");
		
		
		Set<Entry<String, String>> entry = map.entrySet();
		
		/*
		 * 第一種遍歷方法
		 */
		for (Entry<String, String> entry2 : entry) {
			System.out.println(entry2.getKey()+" = "+entry2.getValue());			
		}
		
		Set<String> set = map.keySet();
		
		for(String s :set){
			System.out.println(s+" = "+map.get(s));
		}
		
	System.out.println(map.get("1"));

	}

}
